﻿using System;
using System.Collections.Generic;
using System.Text;
using YouHP.BLL;
using YouHP.Model.Group;
using YouHP.Model;
using System.Web;
using YouHP.Utility;

namespace YouHP.Pages.Group
{
   public class MyGroups:BasePage
    {
        protected List<GroupInfo> groupListLatest;
        protected List<GroupInfo> groupListHotest;
        protected List<GroupInfo> GroupListByUser;
        protected List<DiseaseInfo> DiseaseLst;
        protected List<TreatmentInfo> TreatmentLst;
        protected List<DistrictInfo> ProvinceList;

        protected int _pageSize = 21;
        protected int _pageIndex = 1;
        protected int _pageCount = 0;
        protected int _groupCount;
        protected string PagingString;
        protected int n = 5;

        protected override void ShowPage()
        {
            base.ShowPage();
            this.AddLocation("病友个人圈", "/Group/MyGroups.aspx");
            this.SetTitle("病友个人圈");

            groupListLatest = GroupBLL.Instance.GetGroupListLatest(n);
            groupListHotest = GroupBLL.Instance.GetGroupListHotest(n);

            DiseaseLst = DiseaseBLL.Instance.GetAllDiseaseByName("");
            TreatmentLst = TreatmentBLL.Instance.GetAllTreatmentByName("");
            ProvinceList = DistrictBLL.Instance.GetDistrictListByParent(0);

            _pageIndex = RequestTools.GetQueryInt("page", 1);
            GroupListByUser = GroupBLL.Instance.GetAllGroupsByUserId(_pageSize, _pageIndex, UserData.Id, out _groupCount);

            _pageCount = Utils.GetPageCount(_groupCount, _pageSize);

            string query = HttpContext.Current.Request.Url.Query;
            query = Utils.RemoveQueryItem(query, "page");

            PagingString = this.GetPagingString(_pageIndex, _pageCount,
                "/Group/MyGroups.aspx" + query, "page");



        }
    }
}
